package com.mmm.nlp;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.util.Properties;
import java.io.FileInputStream;

/**
 * Created with IntelliJ IDEA.
 * User: Zhendong
 * Date: 4/21/13
 * Time: 9:50 AM
 * To change this template use File | Settings | File Templates.
 */
public class AppMain
{
  public static void main( String[] args ) throws Exception
  {
    if(args.length ==0)
    {
      System.out.println("Could not find input property file, program will quit.");
      System.out.println("please create a text file with file path information in <...>:");
      System.out.println("inputFilePath=<Input file name and path>\n" +
          "lexiconFilePath=<Input file name and path>\n" +
          "outputFilePath=<Output file name and path>");
      System.exit(-1);
    }
    else
    {
      FileInputStream propFile = new FileInputStream(args[0]);
      Properties ps = new Properties();
      ps.load(propFile);
      Properties sys_ps = System.getProperties();
      for(Object key : ps.keySet())
      {
        sys_ps.put(key, ps.get(key));
      }
    }

    ApplicationContext context =
        new ClassPathXmlApplicationContext(new String[] {"conf/TaggedTextBuilder-Settings.xml"});
    SimpleTaggedTextBuilder builder = (SimpleTaggedTextBuilder)context.getBean("builder");
    builder.build();
  }
}
